// el:指令属性所在的标签对象
// binding:包含指令相关信息数据的对象

export default {
  install(Vue) {
    // 防止重复点击
    Vue.directive("clickReTime", {
      inserted(el, binding) {
        el.addEventListener("click", () => {
          if (!el.disabled) {
            el.disabled = true;
            setTimeout(() => {
              el.disabled = false;
            }, binding.value || 2000);
          }
        });
      },
    });
    // 字母大写
    Vue.directive("upperText", function (el, binding) {
      el.textContent = binding.value.toUpperCase();
    });
  },
};
